﻿@model IEnumerable<MVCTask.Models.Status>

@{
    ViewBag.Title = "Tasks by Status";
}
<h2>Showing Tasks by Status</h2>
<p>
    @Html.ActionLink("Add New Status", "Create")
</p>
@foreach (var statusItem in Model)
{
    <h3>@Html.DisplayFor(modelItem => statusItem.Description) (@Html.DisplayFor(modelItem => statusItem.Tasks.Count) tasks)</h3>
    <p>@Html.ActionLink("Edit", "Edit", new { statusItem.ID })</p>
    <table id="table">
    <tr>
        <th>
            Description
        </th>
        <th>
            Category
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in statusItem.Tasks)
    {
        <tr>
            <td>@Html.DisplayFor(modelItem => item.Description)</td>
            <td>@Html.DisplayFor(modelItem => item.Category.Description)</td>
            <td>
                @Html.ActionLink("Edit", "Edit", "Task", new { id = item.ID }, new { })
            </td>
        </tr>
    }
</table>
}